home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 November: Tool Chest / Dev.CD Nov 00 TC Disk 2.toast / pc / sample code / quicktime / basics / qtshell / common files / qtutilities.h < prev    next >
Encoding:
Text File  |  2000-09-28  |  7.2 KB  |  239 lines

  1. //////////
  2. //
  3. //    File:        QTUtilities.h
  4. //
  5. //    Contains:    Some utilities for working with QuickTime movies.
  6. //                All utilities start with the prefix "QTUtils_".
  7. //
  8. //    Written by:    Tim Monroe
  9. //                Based on the DTSQTUtilities package by Apple DTS.
  10. //                This is essentially a subset of that package, revised for cross-platform use.
  11. //
  12. //    Copyright:    © 1996-1999 by Apple Computer, Inc., all rights reserved.
  13. //
  14. //    Change History (most recent first):
  15. //
  16. //       <2>         02/03/99    rtm        moved non-QTVR-specific utilities from QTVRUtilities to here
  17. //       <1>         09/10/97    rtm        first file
  18. //       
  19. //////////
  20.  
  21. #pragma once
  22.  
  23.  
  24. //////////
  25. //
  26. // header files
  27. //
  28. //////////
  29.  
  30. #ifndef __QTUtilities__
  31. #define __QTUtilities__
  32.  
  33. #ifndef __MOVIES__
  34. #include <Movies.h>
  35. #endif
  36.  
  37. #ifndef __MOVIESFORMAT__
  38. #include <MoviesFormat.h>
  39. #endif
  40.  
  41. #ifndef __MEDIAHANDLERS__
  42. #include <MediaHandlers.h>
  43. #endif
  44.  
  45. #ifndef __NUMBERFORMATTING__
  46. #include <NumberFormatting.h>
  47. #endif
  48.  
  49. #ifndef __QUICKTIMECOMPONENTS__
  50. #include <QuickTimeComponents.h>
  51. #endif
  52.  
  53. #ifndef __QUICKTIMEVR__
  54. #include <QuickTimeVR.h>
  55. #endif
  56.  
  57. #ifndef __QTSMOVIE__
  58. #include <QTSMovie.h>
  59. #endif
  60.  
  61. #ifndef __ENDIAN__
  62. #include <Endian.h>
  63. #endif
  64.  
  65. #ifndef __GESTALT__
  66. #include <Gestalt.h>
  67. #endif
  68.  
  69. #ifndef __FIXMATH__
  70. #include <FixMath.h>
  71. #endif
  72.  
  73. #ifndef __MACWINDOWS__
  74. #include <MacWindows.h>
  75. #endif
  76.  
  77. #ifndef __PRINTING__
  78. #include <Printing.h>
  79. #endif
  80.  
  81. #ifndef __SCRIPT__
  82. #include <Script.h>
  83. #endif
  84.  
  85. #ifndef __SOUND__
  86. #include <Sound.h>
  87. #endif
  88.  
  89. #ifndef _STRING_H
  90. #include <string.h>
  91. #endif
  92.  
  93. #ifndef _STDLIB_H
  94. #include <stdlib.h>
  95. #endif
  96.  
  97. #ifndef __TEXTUTILS__
  98. #include <TextUtils.h>
  99. #endif
  100.  
  101. #ifndef __TRAPS__
  102. #include <Traps.h>
  103. #endif
  104.  
  105.  
  106. //////////
  107. //
  108. // compiler flags
  109. //
  110. //////////
  111.  
  112. #define CONTENT_RATING_AVAIL        0            // is movie content-rating capability implemented?
  113.  
  114.  
  115. //////////
  116. //
  117. // constants
  118. //
  119. //////////
  120.  
  121. // constants used for QTUtils_SaveMovie
  122. #define kSavePrompt                    "Save Movie as:"
  123. #define kSaveMovieFileName            "untitled.mov"
  124. #define kSaveResName                "Movie Resource"
  125.  
  126. // constants used for QTUtils_PrintMoviePICT
  127. enum eQTUPICTPrinting {
  128.     kPrintFrame                        = 1, 
  129.     kPrintPoster                    = 2
  130. };
  131.  
  132. // constants used for QTUtils_GetMovieFileLoopingInfo
  133. enum {
  134.     kNormalLooping                    = 0, 
  135.     kPalindromeLooping                = 1, 
  136.     kNoLooping                        = 2
  137. };
  138.  
  139. #define kQTVideoEffectsMinVers        0x0300        // version of QT that first supports QT video effects
  140. #define kQTFullScreenMinVers        0x0209        // version of QT that first supports full-screen calls
  141. #define kQTWiredSpritesMinVers        0x0300        // version of QT that first supports wired sprites
  142.  
  143. // constants for GetQuickTimePreference/SetQuickTimePreference settings
  144. #define kConnectionSpeedPrefsType    FOUR_CHAR_CODE('cspd')
  145. #define kContentRatingPrefsType        FOUR_CHAR_CODE('crat')
  146.  
  147. enum {
  148.     kQTVRSpeakerButton         = mcFlagSuppressSpeakerButton,
  149.     kQTVRBackButton         = mcFlagQTVRSuppressBackBtn,
  150.     kQTVRZoomButtons         = mcFlagQTVRSuppressZoomBtns,
  151.     kQTVRHotSpotButton         = mcFlagQTVRSuppressHotSpotBtn,
  152.     kQTVRTranslateButton     = mcFlagQTVRSuppressTranslateBtn,
  153.     kQTVRHelpText             = mcFlagQTVRSuppressHelpText,
  154.     kQTVRHotSpotNames         = mcFlagQTVRSuppressHotSpotNames,
  155.     kQTVRCustomButton         = mcFlagsUseCustomButton
  156. };
  157.  
  158.  
  159. //////////
  160. //
  161. // data types
  162. //
  163. //////////
  164.  
  165. #if CONTENT_RATING_AVAIL
  166. // structure of content rating data for GetQuickTimePreference
  167. struct ContentRatingPrefsRecord {
  168.     UInt16                            fContentRating;
  169.     UInt16                            fContentTypes;
  170. };
  171. typedef struct ContentRatingPrefsRecord ContentRatingPrefsRecord;
  172. #endif
  173.  
  174.  
  175. //////////
  176. //
  177. // function prototypes
  178. //
  179. //////////
  180.  
  181. Boolean                        QTUtils_TrapAvailable (short theTrapWord);
  182. Boolean                        QTUtils_IsQuickTimeInstalled (void); 
  183. Boolean                        QTUtils_IsQuickTimeCFMInstalled (void);
  184. long                        QTUtils_GetQTVersion (void);
  185. Boolean                        QTUtils_HasQuickTimeVideoEffects (void);
  186. Boolean                        QTUtils_HasFullScreenSupport (void);
  187. Boolean                        QTUtils_HasWiredSprites (void);
  188. Boolean                        QTUtils_IsStreamedMovie (Movie theMovie);
  189. OSErr                        QTUtils_SaveMovie (Movie theMovie);
  190. Boolean                        QTUtils_IsControllerBarVisible (MovieController theMC); 
  191. short                        QTUtils_GetControllerBarHeight (MovieController theMC);
  192. void                        QTUtils_HideControllerBar (MovieController theMC);
  193. void                        QTUtils_ShowControllerBar (MovieController theMC);
  194. void                        QTUtils_ToggleControllerBar (MovieController theMC);
  195. void                        QTUtils_HideControllerButton (MovieController theMC, long theButton); 
  196. void                        QTUtils_ShowControllerButton (MovieController theMC, long theButton); 
  197. void                        QTUtils_ToggleControllerButton (MovieController theMC, long theButton);
  198. void                        QTUtils_ResetControllerButton (MovieController theMC, long theButton);
  199. Boolean                        QTUtils_IsControllerButtonVisible (MovieController theMC, long theButton);
  200. Boolean                        QTUtils_IsMediaTypeInMovie (Movie theMovie, OSType theMediaType);
  201. Boolean                        QTUtils_MovieHasTimeCodeTrack (Movie theMovie);
  202. Boolean                        QTUtils_MovieHasSoundTrack (Movie theMovie);
  203. MediaHandler                QTUtils_GetSoundMediaHandler (Movie theMovie);
  204. OSErr                        QTUtils_UpdateMovieVolumeSetting (Movie theMovie);
  205. OSErr                        QTUtils_PrintMoviePICT (Movie theMovie, short x, short y, long PICTUsed);
  206. OSErr                        QTUtils_SelectAllMovie (MovieController mc);
  207. ImageDescriptionHandle        QTUtils_MakeSampleDescription (long theEffectType, short theWidth, short theHeight);
  208. OSErr                        QTUtils_GetContentRatingFromMovie (Movie theMovie, UInt16 *theRating, UInt32 *theReasons);
  209. OSErr                        QTUtils_AddContentRatingToMovie (Movie theMovie, UInt16 theRating, UInt32 theReasons);
  210. OSErr                        QTUtils_AddUserDataTextToMovie (Movie theMovie, char *theText, OSType theType);
  211. OSErr                        QTUtils_AddCopyrightToMovie (Movie theMovie, char *theText);
  212. OSErr                        QTUtils_AddMovieNameToMovie (Movie theMovie, char *theText);
  213. OSErr                        QTUtils_AddMovieInfoToMovie (Movie theMovie, char *theText);
  214. OSErr                        QTUtils_GetMovieFileLoopingInfo (Movie theMovie, long *theLoopInfo);
  215. OSErr                        QTUtils_SetMovieFileLoopingInfo (Movie theMovie, long theLoopInfo);
  216. OSErr                        QTUtils_SetLoopingStateFromFile (Movie theMovie, MovieController theMC);
  217. OSErr                        QTUtils_MakeMovieLoop (Movie theMovie, Boolean isPalindrome);
  218. char *                        QTUtils_GetTrackName (Track theTrack);
  219. OSErr                        QTUtils_SetTrackName (Track theTrack, char *theText);
  220. char *                        QTUtils_MakeTrackNameByType (Track theTrack);
  221. Boolean                        QTUtils_IsImageFile (FSSpec *theFSSpec);
  222. Boolean                        QTUtils_IsMovieFile (FSSpec *theFSSpec);
  223. void                        QTUtils_ConvertFloatToBigEndian (float *theFloat);
  224. StringPtr                    QTUtils_ConvertCToPascalString (char *theString);
  225. char *                        QTUtils_ConvertPascalToCString (StringPtr theString);
  226. OSErr                        QTUtils_DeleteAllReferencesToTrack (Track theTrack);
  227. TimeValue                    QTUtils_GetFrameDuration (Track theTrack);
  228. long                        QTUtils_GetFrameCount (Track theTrack);
  229. void                        QTUtils_GetMaxWindowDepth (CWindowPtr theWindow, short *thePixelType, short *thePixelSize);
  230. void                        QTUtils_GetMaxScreenDepth (Rect *theGlobalRect, short *thePixelType, short *thePixelSize);
  231. long                        QTUtils_GetUsersConnectionSpeed (void);
  232. OSErr                        QTUtils_SetUsersConnectionSpeed (long theSpeed);
  233. OSErr                        QTUtils_GetUsersContentRating (UInt32 *theType, UInt16 *theRating);
  234. OSType                        QTUtils_GetControllerType (Movie theMovie);
  235. OSErr                        QTUtils_SetControllerType (Movie theMovie, OSType theType);
  236. MovieController                QTUtils_ChangeControllerType (MovieController theMC, OSType theType, long theFlags);
  237.  
  238. #endif    // __QTUtilities__
  239.